<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>用户登录</title>
        <link rel="stylesheet" type="text/css" href="/bower_components/bootstrap/dist/css/bootstrap.css">
	    <script type="text/javascript" src="/jquery-3.1.1.js"></script>
	    <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
	    <script type="text/javascript" src="//cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
	    <script type="text/javascript" src="/bower_components/upload-jquery/jquery.upload.js"></script>
    <body>
	    <div class="container">
	        <div class="row">
	        	<div class="col-md-12">
	        		<%if(success!=""){%>
				        <div class="alert alert-danger alert-dismissible" role="alert">
						  	<p><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><%=success%></p>
						</div>
				        <%}%>
        			<div class="page-header">
        				<a href="#">欢迎<%=username%></a>
			    		<a href="/admin/logout">退出</a>
			    		<a href="/admin/addArticle" class="pull-right">添加文章</a>
			        </div>
        			<table class="table">
        				<tr>
        					<th>ID</th>
        					<th>标题</th>
        					<th>内容</th>
        					<th>图片</th>
        					<th width="80">分类</th>
        					<th width="120">操作</th>
        				</tr>
        				<%for(var i=0;i<articles.length;i++){%>
	        				<tr>
	        					<td><%=articles[i].id%></td>
	        					<td><%=articles[i].title%></td>
	        					<td><%=articles[i].content%></td>
	        					<td><img width="50" src="/<%=articles[i].img%>"></td>
	        					<td><%=articles[i].cata_name%></td>
	        					<td>
	        						<a href="/admin/editArticle?id=<%=articles[i].id%>" class="btn btn-xs btn-success">编辑</a>
	        						<a href="/admin/delArticle?id=<%=articles[i].id%>" class="btn btn-xs btn-danger">删除</a>
	        					</td>
	        				</tr>
        				<%}%>
        			</table>
	        	</div>
	        </div>
        </div>
        <script type="text/javascript">
	        setTimeout(function(){
			$(".alert").fadeOut(2000)
		},3000)

	        $(function(){
	        	$("/admin/text",function(respons,status){
	        		if (status=="success") {
	        			alert(respons)
	        		}
	        	})
	        })
        </script>
    </body>
</html>